@echo off

SET DBMS_SERVER=.
SET CONNECTION_OPTIONS=-E
SET STAGING_DATABASE_NAME=EducationSystem

if exist ..\setConnectivity.cmd (
	call ..\setConnectivity.cmd
)

:: SQL\Populate\Tables
cd populate || exit 1

for %%T in (
            POPULATE_ROLE.sql
            ) do (
    sqlcmd -S %DBMS_SERVER% %CONNECTION_OPTIONS% -d %STAGING_DATABASE_NAME% -b  -i %%T || goto FAIL
    echo %%~nT table populated.
)

goto SUCCESS
:FAIL
exit 1
::echo ERROR OCCURED. Press any key to exit...
::pause >nul

goto EOF
:SUCCESS
echo SUCCESS POPULATE ALL.
rem pause